; TestController must be restarted before any changes in this file will be used.

; Manual is here: https://lygte-info.dk/project/TestControllerConfigDevice%20UK.html

; Tested with B&K Precision 9115-AT DC Power Supply

#metadef
#idString BK PRECISION, BK9115
#name B&K Precision 9115
#handle BK9115
#replaceText MaxVoltage 80
#replaceText MaxCurrent 60
#replaceText MaxPower 1200

#metadef
#idString BK PRECISION, BK9116
#name B&K Precision 9116
#handle BK9116
#replaceText MaxVoltage 150
#replaceText MaxCurrent 30
#replaceText MaxPower 1200

#metadef
#idString BK PRECISION, BK9117
#name B&K Precision 9117
#handle BK9117
#replaceText MaxVoltage 80
#replaceText MaxCurrent 120
#replaceText MaxPower 3000

#meta
#author jmurray@jmaudio.com.au
#idString BK PRECISION, BK911x
#name B&K Precision BK911x
#handle BK911x
#port COM


;--- Values

#value Voltage V D3 
#value Current A D3 
#value Power W D1

#askValues :MEAS:VOLT?;:MEAS:CURR?;:MEAS:POW?

#askValuesReadFormat 

#initCmd  :SYST:REM

#finalCmd :SYST:LOC

#outputOff :OUTP 0



#interfaceType PS
#interface setVoltage :VOLT (value)
#interface setCurrent :CURR (value)
#interface setOn :OUTP (value);[*OPC]
#interface getVoltage :VOLT?
#interface getCurrent :CURR?
#interface getOn :OUTP:STAT?
#interface readVoltage 0 
#interface readCurrent 1
#interface readPower 2


;--- Setup Dialogue

;--- Output Page (first page)


#cmdSetup number Voltage Fixed_Output
:read: VOLT?
:write: VOLT
Volt 0 MaxVoltage

#cmdSetup number Current Fixed_Output
:read: CURR?
:write: CURR
Amps 0 MaxCurrent


;--- Over-voltage Protection (second page)

#cmdSetup number OverVoltage_Level OVP
:read: VOLT:PROT?
:write: VOLT:PROT
Volt 0 85

#cmdSetup number OverVoltage_Delay OVP
:read: VOLT:PROT:DEL?
:write: VOLT:PROT:DEL
:tip: Set software-voltage protection delay time
s 0.001 0.6

#cmdSetup checkbox OverVoltage_Protection OVP
:read: VOLT:PROT:STAT?
:write: VOLT:PROT:STAT
Enable 0 1

#cmdSetup infoAsk OverVoltage_Triggered? OVP
;:read: VOLT:PROT:TRIG? ; While documented, this command does not provide a response
:read: STAT:QUES?
:readmath: matchBitsList(value,"0","Clear","1","Triggered")

#cmdSetup button OverVoltage_Protection_Clear OVP
:write: PROT:CLE

#cmdSetup buttonsOn Output
:read: OUTP?;[*OPC]
:write: OUTP #;[*OPC]
:tip: Turn output on or off
:updatealloff:
Off 0
On 1

